import 'dart:async';
import 'dart:ui' as ui;

import 'package:flutter/material.dart';

Future<Size> getImageSize(String uri) {
  final image = Image.network('src');
  final comp = Completer<ui.Image>();
  image.image.resolve(ImageConfiguration.empty).addListener(
      ImageStreamListener((ImageInfo info, _) => comp.complete((info.image))));
  return comp.future
      .then((image) => Size(image.width.toDouble(), image.height.toDouble()));
}
